#递归

% recursion
% factorial: 0! = 1, 1! = 1, ..., 5! = 120
% basic case
factorial(0，1):-!.
factorial(Num, Fact):-
    Num_next is Num - 1,
    factorial(Num, Fact_next),
    Fact is Num * Fact_next.


% base case
power(_, 0, 1).
power(X,Y,Result):-
    Y_next is Y - 1,
    power(X, Y_next,　Result_next),
    Result is Result_next * X.



% fibonacci sequence
fix(1,1):-!.
fix(2,1):-!.
fix(Index, Valua):-
    Index_1 is Index - 1,
    Index_2 is Index - 2,
    fib(Index_1, Value_1),
    fib(Index_1, Value_2)
    Value is Value_1 + Value_2.

